{extend name="index/base" /}
{block name="body"}
<blockquote class="layui-elem-quote">
	<a href="javascript:;" class="layui-btn layui-btn-sm" id="add">
		<i class="layui-icon">&#xe608;</i> 添加角色组
	</a>
</blockquote>
<div class="layui-form">
  <table class="layui-table admin-table">
    <colgroup>
      <col width="50">
      <col width="150">
      <col width="150">
      <col width="200">
      <col>
    </colgroup>
    <thead>
      <tr>
        <th>ID</th>
        <th>PID</th>
        <th>名称</th>
        <th>状态</th>
        <th width="60">操作</th>
      </tr> 
    </thead>
    <tbody>
    {volist name="list" id="vo"}
      <tr>
        <td>{$vo.id}</td>
        <td>{$vo.pid}</td>
        <td>{$vo.name|html}</td>
        <td><span style="color:#00a65a;"><i class="fa fa-circle"></i> 正常</span></td>
        <td>
        <div class="layui-btn-group">
          {neq name="vo.pid" value="0"}
    			<a href="javascript:;" class="layui-btn layui-btn-xs edit " title="编辑" data-url="{:url('edit',['ids'=>$vo['id']])}">编辑</a>
    			<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-danger confirm_del" title="删除" data-url="{:url('del',['ids'=>$vo['id']])}">删除</a>
          {/neq}
    		</div>
        </td>
      </tr>
     {/volist}
    </tbody>
  </table>
</div>

{/block}

{block name="script"}
<script>
layui.use(['tool'], function(){
  var $ = layui.jquery, 
      form = layui.form,
      layer=layui.layer;
  
  //添加
  $('#add,.edit').click(function(){
    var url = '{:url('add')}',title = '添加角色组';
    if($(this).hasClass('edit')){
      url = $(this).data('url');
      title = '编辑角色组';
    }
  	parent.layer.open({
      title:title,
      type: 2,
      area: ['50%', '80%'],
      fixed: false, //不固定
      maxmin: true,
      content: url,
      shade:0,
      id:'group_add'
    });
  });



  
});
</script>
{/block}